import request from '@/request/index'
import type { UserInfoResult } from './type'

enum URL {
  LOGIN = 'user/login',
  LOGOUT = '',
  USERINFO = 'user/info'
}

export const login = <T>(data: T) => request.post<{token: string}>(URL.LOGIN, data) // 登录
export const logout = () => request.post(URL.LOGOUT) // 退出登录
export const getUserInfo = () => request.get<UserInfoResult>(URL.USERINFO) // 获取用户信息
